Skip to main content

Bug Tracker

Side navigation

Ticket #3784: grep[6053].diff
File grep[6053].diff, 0.7 KB (added by flesler, January 05, 2009 11:06PM UTC)
Index: src/core.js
===================================================================
--- src/core.js	(revision 6053)
+++ src/core.js	(working copy)
@@ -1083,6 +1083,9 @@
 	},
 
 	grep: function( elems, callback, inv ) {
+		if( filter && !inv )
+			return filter.call( elems, callback );
+		
 		var ret = [];
 
 		// Go through the array, only saving the items
@@ -1114,7 +1117,8 @@
 // It's included for backwards compatibility and plugins,
 // although they should work to migrate away.
 
-var userAgent = navigator.userAgent.toLowerCase();
+var userAgent = navigator.userAgent.toLowerCase(),
+	filter = Array.prototype.filter;
 
 // Figure out what browser is being used
 jQuery.browser = {

Download in other formats:

Original Format